<?php
header('Content-type:text/html; charset=utf-8');
header('Cache-Control: public');
ini_set('display_errors',1);

require_once("classes/Membre.class.php");
require_once("classes/Scan.class.php");
require_once("classes/Archives.class.php");

session_start(); //On le met après la déclaration des objets sinon erreur lors de la lecture dans les variables de sessions

require_once("includes/Params.ini.php");
require_once("includes/DB.class.php");
require_once("includes/Formulaire.class.php");
require_once("includes/Site.class.php");
require_once("includes/Session.class.php");

require("toolbox/header.php");
require("toolbox/frontcontroller.php");

Header::set_title("Accueil");
Header::set_css("toolbox/site.css");
Controller::load_content();	

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<?php
		echo "<title>".Header::get_title()."</title>\n\r";
		
		$tableau=Header::get_css();
		foreach ($tableau as $elt) {
			echo "<link href=\"".$elt."\" rel=\"stylesheet\" type=\"text/css\" />\n\r";
		}
		$tableau=Header::get_src_javascript();
		foreach ($tableau as $elt) {
			echo "<script type=\"text/javascript\" src=\"".$elt."\"></script>\n\r";
		}
		$tableau=Header::get_javascript();
		foreach ($tableau as $elt) {
			echo "<script type=\"text/javascript\">".$elt." </script>\n\r";
		}
		
		?>
	</head>
	
	<body>
	
		<?php //if(Session::IsOpen('membre'))
			{
				echo "<div id='login'>";
				require_once('modules/Login/module.php');
				echo "</div>";
			}
		?>

	
		
		<div id="mainbloc">		
			<div id="bloc-login">
			
				<?php 
					//echo "<div id='login'>";
					require_once('modules/Login/module.php');
					//echo "</div>";				
				
				/*if(!Session::IsOpen('membre'))
					{
						echo "<div id=\"bt-login\"> </div>";
						echo "<div id=\"barre-login\"> <form action='index.php?module=Login&amp;action=Login' method='post'>
						<input type='text' class='inpout_pseudo' name='pseudo'/>
						<input type='text' class='inpout_mdp' name='mdp'/>
						<input type='hidden' name='urlprec' value=\"".$_SERVER['QUERY_STRING']."\" />
						<input type='image' class='inpout_connexion' value=' '/>
						</form></div>";
					}*/
				?>
			</div>
		
			<div id="bloc-banniere">
				<a href='index.php'><div id="banniere"> </div></a>
			</div>
			<a href='index.php'><div id="bt-accueil"> </div></a>
			<a href='?module=scan'><div id="bt-bibliotheque"> </div></a>
			<a href="?module=espace_personnel"><div id="bt-clubvip"> </div></a>
			<a href='?module=forum'><div id="bt-forum"> </div></a>
			
			<div id='zonemessage' style='background:#FFC24E'> 
			 <?php
                    Site::liste_message();
               ?>                    
              </div>
		
			<div id='menu'>
				<?php
					if(Session::IsOpen('membre'))
					{
						if(strcmp(Session::Info('membre', 'rang'),"Administrateur") == 0) 	
							echo "<a href='?module=Admin'>Admin</a>";
					}
				?>
			</div>
			
			<div id="corps-de-page">
			
				<?php
					if(!(isset($_GET['module']) && ($_GET['module']=='Admin' || $_GET['module']=='Recherche')))
					{
						//echo '<div id="recherche">';
						require_once('modules/recherche/module.php');
						//echo '</div>';
					}
				?>			
			
				<?php //<div id='contenu'> ?>
				<?php
					Controller::get_content();
				?>	
				<?php //</div> ?>
				
				<?php 
					if(isset($_GET['module'])) {if($_GET['module'] == 'scan' || $_GET['module'] == 'Admin') {
				?>
			
				<script type="text/javascript" charset="utf-8">
					$(document).ready(function()
					{
						$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', opacity:0.95, keyboard_shortcuts:true});
						$(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', opacity:0.95, keyboard_shortcuts:true});
					});
				</script>

				</div>			
			</div>
		</div>
		
		<?php }} //fin de l'intégration du script ?>
	</body>
</html>